package com.sgam.mf.domain.entity;


import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

import org.codehaus.jackson.map.annotate.JsonDeserialize;
import org.codehaus.jackson.map.annotate.JsonSerialize;
import org.hibernate.annotations.Formula;
import org.springframework.format.annotation.DateTimeFormat;
import org.hibernate.annotations.Formula;

import com.sgam.utils.CustomDateDeserializer;
import com.sgam.utils.CustomDateSerializer;

@Entity
@Table(name = "VREPORT_CONTRACT_PAYMENTS")
public class VreportContractPayments {

		@Id
		@Column(name = "id")
		@GeneratedValue
		private Integer id;
		
		@Column(name = "contract_date") 
		private String contractDate;
		
		@JsonSerialize(using = CustomDateSerializer.class)
		@JsonDeserialize(using = CustomDateDeserializer.class)
		@DateTimeFormat(pattern="dd.MM.yyyy")
		@Column(name = "contract_d") 
		private Date contractD;
		
		@Column(name = "contractat_flg") 
		private Integer contractatFlg;
		
		@Column(name = "contract_no") 
		private String contractNo;
		
		@Column(name = "ref_company_fk") 
		private Integer refCompanyFk;
		
		@Column(name = "company") 
		private String company;
		
		@Column(name = "contract_person") 
		private String contractPerson;
		
		@Column(name = "appl_person") 
		private String applPerson;
		
		@Column(name = "finalizat_flg") 
		private Integer finalizatFlg;
		
		@Column(name = "finalizat") 
		private String finalizat;
		
		@Column(name = "amount") 
		private Long amount;
		
		@Column(name = "prepayment") 
		private Long prepayment;
		
		@Column(name = "datorie") 
		private Long datorie;
		
		@Column(name = "uid") 
		private Integer uid;
		
		@Column(name = "uname") 
		private String uname;
		
		@Column(name = "sum") 
		private Long sum;
		
		@Column(name = "payd_amount") 
		private Long paydAmount;
		
		@Column(name = "uprc") 
		private Integer uprc;
		
		@JsonSerialize(using = CustomDateSerializer.class)
		@JsonDeserialize(using = CustomDateDeserializer.class)
		@DateTimeFormat(pattern="dd.MM.yyyy")
		@Column(name = "payment_date") 
		private Date paymentDate;
//		
//		@Transient
//		private Long ord;
		
		@Formula("payd_Amount/(sum+1)")
		public Long ord;

		public Integer getId() {
			return id;
		}

		public void setId(Integer id) {
			this.id = id;
		}

		public String getContractDate() {
			return contractDate;
		}

		public void setContractDate(String contractDate) {
			this.contractDate = contractDate;
		}

		public Date getContractD() {
			return contractD;
		}

		public void setContractD(Date contractD) {
			this.contractD = contractD;
		}

		public Integer getContractatFlg() {
			return contractatFlg;
		}

		public void setContractatFlg(Integer contractatFlg) {
			this.contractatFlg = contractatFlg;
		}

		public String getContractNo() {
			return contractNo;
		}

		public void setContractNo(String contractNo) {
			this.contractNo = contractNo;
		}

		public Integer getRefCompanyFk() {
			return refCompanyFk;
		}

		public void setRefCompanyFk(Integer refCompanyFk) {
			this.refCompanyFk = refCompanyFk;
		}

		public String getCompany() {
			return company;
		}

		public void setCompany(String company) {
			this.company = company;
		}

		public Integer getFinalizatFlg() {
			return finalizatFlg;
		}

		public void setFinalizatFlg(Integer finalizatFlg) {
			this.finalizatFlg = finalizatFlg;
		}

		public String getFinalizat() {
			return finalizat;
		}

		public void setFinalizat(String finalizat) {
			this.finalizat = finalizat;
		}

		public Long getAmount() {
			return amount;
		}

		public void setAmount(Long amount) {
			this.amount = amount;
		}

		public Long getPrepayment() {
			return prepayment;
		}

		public void setPrepayment(Long prepayment) {
			this.prepayment = prepayment;
		}

		public Long getDatorie() {
			return datorie;
		}

		public void setDatorie(Long datorie) {
			this.datorie = datorie;
		}

		public Integer getUid() {
			return uid;
		}

		public void setUid(Integer uid) {
			this.uid = uid;
		}

		public String getUname() {
			return uname;
		}

		public void setUname(String uname) {
			this.uname = uname;
		}

		public Long getSum() {
			return sum;
		}

		public void setSum(Long sum) {
			this.sum = sum;
		}

		public Long getPaydAmount() {
			return paydAmount;
		}

		public void setPaydAmount(Long paydAmount) {
			this.paydAmount = paydAmount;
		}

		public Date getPaymentDate() {
			return paymentDate;
		}

		public void setPaymentDate(Date paymentDate) {
			this.paymentDate = paymentDate;
		}

		public Integer getUprc() {
			return uprc;
		}

		public void setUprc(Integer uprc) {
			this.uprc = uprc;
		}

		public String getContractPerson() {
			return contractPerson;
		}

		public void setContractPerson(String contractPerson) {
			this.contractPerson = contractPerson;
		}

		public String getApplPerson() {
			return applPerson;
		}

		public void setApplPerson(String applPerson) {
			this.applPerson = applPerson;
		}
		
		
//		public Long getOrd() {
//			return getPaydAmount()/getSum();
//		}

	
	
}
